// components/tag/tag.js
Component({
  options: {
    multipleSlots: true // 在组件定义时的选项中启用多slot支持
  },
   externalClasses:['tag-class'],
  /**
   * 组件的属性列表
   */
  properties: {
   
    text:String
  },

  /**
   * 组件的初始数据
   */
  data: {
    backColors: ['#D8E1F8', '#FBDCDE', '#D6EFE2', '#D8F0FC','#FBDCFB'],
    backColor:'',
    textColors: ['#3E69DA', '#EC505C', '#32B16C', '#0FACF6','#EE30EE'],
    textColor:''
  },
  
  attached: function () {
    var index = Math.floor((Math.random() * this.data.textColors.length))
    this.setData({
      textColor: this.data.textColors[index],
      backColor: this.data.backColors[index],
    })
    
  },
  /**
   * 组件的方法列表
   */
  methods: {
    onTap:function(event){
      this.triggerEvent('tapping',{
        text:this.properties.text
      })
    }
  }
})
